package com.framework.validator;

import com.framework.exception.RRException;
import com.framework.exception.menu.RespCode;
import org.apache.commons.lang.StringUtils;


/**
 * 数据校验
 * @author wq
 */
public abstract class Assert {

	public static void isBlank(String str, String message) {
		if (StringUtils.isBlank(str)) {
			throw new RRException("9000",message);
		}
	}

	public static void isNull(Object object, String message) {
		if (object == null) {
			throw new RRException("9000",message);
		}
	}

	public static String hasSpace(String str){
		return str.contains(" ")?str.replace(" ",""):str;
	}

	public static void verifyToken(String token) {
		if(StringUtils.isBlank(token)){
			throw new RRException(RespCode.ERROR_TOKEN);
		}

	}
}
